let path = require('path')
let htmlWebpackPlugin = require('html-webpack-plugin')
function resolve(o) {
    return path.resolve(__dirname, o)
}
module.exports = {
    entry: {
        main: resolve('src/scripts/main.js'),
        a: resolve('src/scripts/a.js')
    }, // 指定入口文件
    output: {
        path: resolve('dist'),
        // filename: '[name]-[hash].js'
        filename: "js/[name]-[chunkhash].js"
    },
    plugins: [
        new htmlWebpackPlugin({
            // filename: "index-[hash].html",
            // filename: 'index-[chunkhash].html',
            template: 'index.html', // 指定根目录下的 index.html
            inject: 'head',
            title: 'html webpack plugin',
            minify: {
                removeComments: true, // 删除注释
                collapseWhitespace: true, //删除空格
            }
        })
    ]
}